using System.Data;
using ET;
namespace DA
{
	public class Districts_DAL
	{
	private clsConnect cls = new clsConnect();

	#region Getdata
	public DataTable BindGirdDistricts(string keywords)
	{
        return cls.Search("sp_tb_Districts_Search", "@KeyWords", keywords);
	}
    public DataTable BindGirdDistricts_Province(int id)
    {
        return cls.GetData_ID_Int("sp_tb_Districts_Detail", "@Province_Id", id);
    }
	#endregion

	#region Insert
	public bool InsertDistricts(Districts_ET data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@Province_Id", data.Province_Id);
	cls.AddParameter("@Districts_Alias", data.Districts_Alias);
	cls.AddParameter("@Districts_Name", data.Districts_Name);
	cls.AddParameter("@Districts_Note", data.Districts_Note);
    cls.ExecuteNonQuery("sp_tb_Districts_Insert");
	return true;
	}
	#endregion

	#region Update
	public bool UpdateDistricts(Districts_ET data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@Districts_Id", data.Districts_Id);
	cls.AddParameter("@Province_Id", data.Province_Id);
	cls.AddParameter("@Districts_Alias", data.Districts_Alias);
	cls.AddParameter("@Districts_Name", data.Districts_Name);
	cls.AddParameter("@Districts_Note", data.Districts_Note);
    cls.ExecuteNonQuery("sp_tb_Districts_Update");
	return true;
	}
	#endregion

	#region Delete
	public bool DeleteDistricts(int id)
	{
        cls.Delete("sp_tb_Districts_Delete", "@Districts_Id", id);
	return true;
	}
	#endregion
	}
}